package com.infosys.cabplanningdao.cab.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.infosys.cabplanning.common.domain.Cab;
import com.infosys.cabplanning.common.domain.CabType;

public class CabRowMapper implements RowMapper<Cab> {
	@Override
	public Cab mapRow(ResultSet rs, int rowNum) throws SQLException {
		CabType cabType = new CabType();
		cabType.setCabTypeID(rs.getInt("type_id"));
		cabType.setName(rs.getString("name"));
		cabType.setCapacity(rs.getInt("capacity"));
		
		Cab cab = new Cab();
		cab.setCabType(cabType);
		cab.setCabId(rs.getInt("cab_id"));
		cab.setRegistrationNo(rs.getString("registration"));
		
		return cab;
	}

}
